using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using WebRobot.App_code;
using Scb.Framework;

namespace WebRobot.MasterPage
{
  public partial class BaseLine : System.Web.UI.MasterPage
  {

    #region Event
    
    protected void Page_Load(object sender, EventArgs e)
    {
      try
      {
        if (((BasePage)Page).CurrentUser != null)
          lbUser.InnerHtml = "Wellcome,&nbsp;" + ((BasePage)Page).CurrentUser.UserName;
        else
        {
          Response.Redirect("Login.aspx");
        }
      }
      catch(Exception ex)
      {
        Response.Redirect("Login.aspx");
        Logger.Error("WebRobot.MasterPage.BaseLine::Page_Load", ex);
      }
    }

    #endregion

    #region Helper

    private void DoLogout()
    {
      FormsAuthentication.SignOut();
      Session.Abandon();
      Session.Clear();
      Response.Redirect("Login.aspx");
    }

    #endregion

    protected void lbtnLogout_Click(object sender, EventArgs e)
    {
        DoLogout();
    }

  }
}
